/*
	JQuery KissSlider plugin
	v1.4.2
	https://github.com/VivienLN/jquery.kiss-slider
*/
!
function(t) {
	var e = function(t, e) {
			return this.options = {}, this.$container, this.$slides, this.currentIndex, this.animated = !1, this.slideWidth, this.slideHeight, this.autoscrollInterval, this.startX, this.startY, this.startTime, this.init(t, e)
		};
	e.instances = [], e.prototype.init = function(i, n) {
		var s = {
			slideSelector: null,
			nextSelector: null,
			prevSelector: null,
			paginationSelector: null,
			paginationBefore: "",
			paginationAfter: "",
			paginationCurrentClass: "current",
			startIndex: 0,
			startingZ: 1,
			slideDuration: 400,
			easing: "swing",
			autoscrollDelay: 0,
			noAnim: !1,
			beforeSlide: null,
			afterSlide: null,
			init: null,
			allowSwipe: !0
		},
			o = this,
			r = this.options = t.extend({}, s, n);
		if (o.$container = i, o.$slides = r.slideSelector ? t(r.slideSelector) : i.children(), o.$slides.css({
			position: "absolute",
			left: 0,
			top: 0,
			zIndex: r.startingZ
		}), o.$container.css({
			position: "relative",
			overflow: "hidden"
		}), o.resizeSlider(), o.$slides.css({
			width: "100%"
		}), r.paginationSelector && o.$slides.length > 1) {
			for (var a = 0; a < o.$slides.length; a++) t(r.paginationBefore + "<button>" + (a + 1) + "</button>" + r.paginationAfter).appendTo(r.paginationSelector).data("kissSliderTarget", a);
			t("button", r.paginationSelector).click(function(t) {
				o.paginationClick(this), t.preventDefault()
			}), t("button", r.paginationSelector).filter(function() {
				return t(this).data("kissSliderTarget") == r.startIndex
			}).addClass("active")
		}
		return r.autoscrollDelay && (o.startAutoScroll(r.autoscrollDelay), this.$container.mouseenter(function() {
			o.stopAutoScroll()
		}), this.$container.mouseleave(function() {
			o.startAutoScroll(r.autoscrollDelay)
		})), t(window).resize(function() {
			return o.resizeSlider()
		}), r.nextSelector && t(r.nextSelector).click(function(t) {
			o.nextSlide(), t.preventDefault()
		}), r.prevSelector && t(r.prevSelector).click(function(t) {
			o.prevSlide(), t.preventDefault()
		}), r.allowSwipe && (o.$container[0].addEventListener("touchstart", function(t) {
			o.touchStartEvent(t)
		}, !1), o.$container[0].addEventListener("touchend", function(t) {
			o.touchEndEvent(t)
		})), o.currentIndex = r.startIndex < o.$slides.length ? r.startIndex : 0, o.$slides.hide().eq(o.currentIndex).show(), o.applyCallback(r.init), e.instances.push(this), this.$container
	}, e.prototype.resizeSlider = function() {
		var e = this;
		e.slideWidth = e.$container.innerWidth(), e.slideHeight = 0, e.$slides.each(function() {
			e.slideHeight = Math.max(e.slideHeight, t(this).outerHeight(!0))
		}), e.$container.css("height", e.slideHeight)
	}, e.prototype.startAutoScroll = function(t) {
		var e = this;
		this.autoscrollInterval || (this.autoscrollInterval = setInterval(function() {
			e.nextSlide()
		}, t))
	}, e.prototype.stopAutoScroll = function() {
		clearInterval(this.autoscrollInterval), this.autoscrollInterval = null
	}, e.prototype.moveTo = function(e, i, n) {
		if (this.animated || e == this.currentIndex) return !1;
		this.animated = !0, e = Math.max(0, Math.min(e, this.$slides.length)), i = i || 1;
		var s = this.$slides.eq(e),
			o = this.$slides.eq(this.currentIndex),
			r = this;
		if (this.applyCallback(this.options.beforeSlide, [this.currentIndex, e]), o.css("zIndex", this.options.startingZ + 1), s.css("zIndex", this.options.startingZ + 2).show(), this.$slides.not(s).not(o).hide(), this.options.paginationSelector && t("button", this.options.paginationSelector).removeClass("active").filter(function() {
			return t(this).data("kissSliderTarget") == e
		}).addClass("active"), n || this.options.noAnim) s.css("left", 0), this.currentIndex = e, this.animated = !1;
		else {
			var a = this.slideWidth * i,
				l = -this.slideWidth * i;
			s.css("left", a).add(o).animate({
				left: "+=" + l
			}, this.options.slideDuration, this.options.easing, function() {
				r.finishSlide(e)
			})
		}
		return !1
	}, e.prototype.finishSlide = function(t) {
		this.animated && (this.applyCallback(this.options.afterSlide, [this.currentIndex, t]), this.currentIndex = t, this.animated = !1)
	}, e.prototype.paginationClick = function(e) {
		var i = t(e).data("kissSliderTarget");
		if (isNaN(i)) return !1;
		var n = i > this.currentIndex ? 1 : -1;
		return this.moveTo(i, n)
	}, e.prototype.nextSlide = function() {
		var t = this.currentIndex + 1 < this.$slides.length ? this.currentIndex + 1 : 0;
		return this.moveTo(t, 1)
	}, e.prototype.prevSlide = function() {
		var t = this.currentIndex - 1 >= 0 ? this.currentIndex - 1 : this.$slides.length - 1;
		return this.moveTo(t, -1)
	}, e.prototype.applyCallback = function(t, e) {
		return "function" == typeof t ? t.apply(this, e) : null
	}, e.prototype.touchStartEvent = function(t) {
		this.startX = t.changedTouches[0].pageX, this.startY = t.changedTouches[0].pageY, this.startTime = (new Date).getTime()
	}, e.prototype.touchEndEvent = function(t) {
		var e = 1e3,
			i = 100,
			n = 50,
			s = (new Date).getTime() - this.startTime;
		if (e >= s) {
			var o = t.changedTouches[0].pageX - this.startX,
				r = t.changedTouches[0].pageY - this.startY,
				a = Math.abs(o),
				l = Math.abs(r);
			a > i && a * n / 100 >= l && (0 > o ? this.nextSlide() : this.prevSlide())
		}
	}, e.callAction = function(t, i, n) {
		var s;
		for (var o in e.instances) if (e.instances[o].$container[0] === t[0]) {
			s = e.instances[o];
			break
		}
		s && e.actions[i].call(null, s, n)
	}, e.actions = {
		next: function(t, e) {
			t.nextSlide()
		},
		previous: function(t, e) {
			t.prevSlide()
		},
		moveTo: function(t, e) {
			t.moveTo(e.index, e.dir)
		}
	}, t.fn.extend({
		kissSlider: function(i, n) {
			return "string" == typeof i ? (e.callAction(this, i, n), this) : (this.each(function() {
				new e(t(this), i)
			}), this)
		}
	})
}(jQuery);